/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   Module Name          : com.yaodian100.ec.tmall.service.TmallService
   Module Description   :

   Date Created      : 2011/10/4
   Original Author   : feeling.wang
   Team              : yaodian100
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   MODIFICATION HISTORY
   ------------------------------------------------------------------------------
   Date Modified       Modified by       Comments
   ------------------------------------------------------------------------------
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
package com.yaodian100.ec.tmall.service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import com.taobao.api.domain.Item;
import com.taobao.api.domain.PropValue;
import com.taobao.api.domain.Trade;
import com.yaodian100.core.common.exception.CoreException;
import com.yaodian100.ec.order.entity.OrderProduct;
import com.yaodian100.ec.order.entity.OrderProductDetail;
import com.yaodian100.ec.order.entity.Orders;

/**
 * @author feeling.wang
 * 
 */
public interface TmallService {

	/**
	 * 全量下载
	 * 
	 * @param start 开始时间 ,default 目前时间往前推24小时
	 * @param end 结束时间,目前时间
	 * @param status ,default TRADE_FINISHED 交易成功
	 * @param page 页数
	 * @return
	 */
	public List<Orders> getTrades(Date start, Date end, String status, int page);

	/**
	 * 取得订单交易资讯
	 * 
	 * @param tid 淘宝商成的订单交易序号
	 * @return
	 */
	public Trade getTrade(String tid);

	public Orders getTradeAndSaveToOrder(String tid, String tradeFrom);

	public Orders getTradeForcePresent(String tid);

	/**
	 * 增量下载订单
	 * 
	 * @param start 开始时间,default 1小时5分前已交易成功的订单
	 * @param end 结束时间,default 1小时前已交易成功的订单
	 * @param status ,default TRADE_FINISHED 交易成功
	 * @return
	 */
	public Integer tradesSoldIncrementGet(Date start, Date end, String status, String[] skipList, Integer page,
			Integer pageSize);

	/**
	 * 上传备注
	 * 
	 * @param start 开始时间
	 * @param end 结束时间
	 * @return
	 */
	public int tradesMemoAdd(Date start, Date end);

	/**
	 * 抓取商品主档资讯
	 */
	public Item getItem(Long iid);

	/**
	 * csv下載訂單
	 * 
	 * @param listFile
	 * @param detailFile
	 * @throws Exception
	 */
	public void csvImportOrder(String listFile, String detailFile) throws Exception;

	/**
	 * 同步訂單
	 */
	public void syncTaobaoOrders();

	public void updateOrderProductAndDetail(String[] specIds, String[] specNames, OrderProduct op, long opCount,
			OrderProductDetail od, long odCount, String[] productIds);

	/**
	 * 取得属性名称
	 * 
	 * @param cid
	 * @param props
	 * @return
	 */
	public List<PropValue> getSkuProps(String cid, String props);

	public Orders updateProductDetailNonInventory(String orderId, Long orderProdId, Long specId, BigDecimal unitPrice,
			String prodName, String specName, String outerCid, String outerProdId, String outerSkuId) throws CoreException;

	public Orders updateTmallOrder(String orderId, String[] presentQty, String[] specProp);
}
